package org.example.utils;

public enum ReturnCodeEnum {
    RC88("88","操作失败"),
    RC00("00","成功"),
    RC400("400","页面找不到异常"),
    RC500("500","系统异常，请稍后重试"),
    USERNAME_OR_PASSWORD_ERROR("188","用户名或密码错误");

    //自定义状态码
    private final String code;
    //自定义描述
    private final String message;

    ReturnCodeEnum(String code,String message){
        this.code=code;
        this.message=message;
    }

    //遍历枚举
    public static ReturnCodeEnum getReturnCodeEnum(String code){
        for (ReturnCodeEnum element : ReturnCodeEnum.values()) {
            if(element.getCode().equalsIgnoreCase(code)){
                return element;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
